package com.jintian.smart.kernel.security.config;

import com.jintian.smart.kernel.security.heartbeat.HeartBeatManager;
import jakarta.annotation.Resource;
import com.jintian.smart.kernel.core.support.IHeartBeatRecordHandler;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 心跳配置
 */
@Configuration
public class HeartBeatConfig {
    /**
     * 间隔时间
     */
    @Value("${smart.heart-beat.interval-seconds: 300}")
    private Long intervalSeconds;

    @Resource
    private IHeartBeatRecordHandler heartBeatRecordHandler;

    @Bean
    public HeartBeatManager heartBeatManager() {
        return new HeartBeatManager(intervalSeconds * 1000L, heartBeatRecordHandler);
    }
}
